package com.me.study.designPatterns.prototype;

import java.math.BigDecimal;
import java.util.StringJoiner;

/**
 * 原型模式：某个实体类
 *
 * @author ME
 */
public class SomeEntity implements Cloneable {

    private int aInt;
    private Integer aInteger;

    private String str;

    private BigDecimal decimal;

    public SomeEntity(int aInt, Integer aInteger, String str, BigDecimal decimal) {
        this.aInt = aInt;
        this.aInteger = aInteger;
        this.str = str;
        this.decimal = decimal;
    }

    public int getaInt() {
        return aInt;
    }

    public void setaInt(int aInt) {
        this.aInt = aInt;
    }

    public Integer getaInteger() {
        return aInteger;
    }

    public void setaInteger(Integer aInteger) {
        this.aInteger = aInteger;
    }

    public String getStr() {
        return str;
    }

    public void setStr(String str) {
        this.str = str;
    }

    public BigDecimal getDecimal() {
        return decimal;
    }

    public void setDecimal(BigDecimal decimal) {
        this.decimal = decimal;
    }

    @Override
    public SomeEntity clone() {
        SomeEntity entity = null;
        try {
            entity = (SomeEntity) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }

        return entity;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", SomeEntity.class.getSimpleName() + "[", "]")
                .add("aInt=" + aInt)
                .add("aInteger=" + aInteger)
                .add("str='" + str + "'")
                .add("decimal=" + decimal)
                .toString();
    }

}
